package com.api.shopapi.mapper;


import com.api.shopapi.entity.MedicationSchedulingNoonItem;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author maochuan
 */
@Repository
@Mapper
public interface MedicationSchedulingNoonItemMapper {

    @Insert("insert into medication_scheduling_noon_item " +
            "(MedicationSchedulingNoonItemCode,MedicationSchedulingNoonCode,Name) " +
            "values (#{medicationSchedulingNoonItem.MedicationSchedulingNoonItemCode} ,#{medicationSchedulingNoonItem.MedicationSchedulingNoonCode} ,#{medicationSchedulingNoonItem.Name} )")
    int insert(@Param("medicationSchedulingNoonItem") MedicationSchedulingNoonItem medicationSchedulingNoonItem);

    @Update("update medication_scheduling_noon_item set MedicationSchedulingNoonCode=#{medicationSchedulingNoonItem.MedicationSchedulingNoonCode} ,Name=#{medicationSchedulingNoonItem.Name} " +
            "where medicationSchedulingNoonItemCode=#{medicationSchedulingNoonItem.medicationSchedulingNoonItemCode}  ")
    int updateByMedicationSchedulingNoonItemCode(@Param("medicationSchedulingNoonItem") MedicationSchedulingNoonItem medicationSchedulingNoonItem);

    @Delete("delete from medication_scheduling_noon_item where MedicationSchedulingNoonItemCode=#{medicationSchedulingNoonItemCode} ")
    int deleteByMedicationSchedulingNoonItemCode(@Param("medicationSchedulingNoonItemCode") String medicationSchedulingNoonItemCode);

    @Select("select * from medication_scheduling_noon_item where MedicationSchedulingNoonItemCode=#{medicationSchedulingNoonItemCode} limit 1")
    MedicationSchedulingNoonItem getByMedicationSchedulingNoonItemCode(@Param("medicationSchedulingNoonItemCode")String medicationSchedulingNoonItemCode);

    @Select("select * from medication_scheduling_noon_item where MedicationSchedulingNoonCode=#{medicationSchedulingNoonCode}")
    List<MedicationSchedulingNoonItem> getListByMedicationSchedulingNoonCode(@Param("medicationSchedulingNoonCode")String medicationSchedulingNoonCode);

    @Delete("delete from medication_scheduling_noon_item where MedicationSchedulingNoonCode=#{medicationSchedulingNoonCode} ")
    int deleteByMedicationSchedulingNoonCode(String medicationSchedulingNoonCode);
}
